import { useState, useTransition } from 'react'
import SearchResults from './SearchResults'

export default function Demo01() {
  const [text, setText] = useState('')
  const [pending, startTransition] = useTransition()
  function onchange(e: any) {
    startTransition(() => {
      setText(e.target.value)
    })
  }
  
  return (
    <div>
      <input type="text" 
        onChange={onchange}
      />
      <div>{pending ? 'input...' : 'end' }</div>
      <SearchResults query={text} />
    </div>
  )
}
